package bingo.codeweaver.view.container;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import bingo.codeweaver.view.AbstractComponent;
import bingo.codeweaver.view.Container;
import bingo.codeweaver.view.IComponent;
import bingo.codeweaver.view.ISupport;


/**
 * 
 * May 28, 2009 7:46:48 AM
 * Author:yangdongyu(yangdy@bingosoft.net)
 * ReadMe:
 * ChangeLog:
 */
public class Page extends AbstractComponent implements Container {
	
	private String pageEncoding = "<%@ page language=\"java\" pageEncoding=\"UTF-8\"%>";
	private List<IComponent> components = new ArrayList<IComponent>();
	private String title;
	private String pageType = "jsp";
	private List<String> headers = new ArrayList<String>();
	
	public Page addHeadFile(String header){
		this.headers.add(header);
		return this;
	}
	

	public List<String> getHeaders() {
		return headers;
	}

	public List<IComponent> getComponents() {
		return components;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getPageEncoding() {
		return pageEncoding;
	}

	public void setPageEncoding(String pageEncoding) {
		this.pageEncoding = pageEncoding;
	}

	public String getPageType() {
		return pageType;
	}

	public void setPageType(String pageType) {
		this.pageType = pageType;
	}

	public Page(){

	}


	/**
	 * 
	 * @param component
	 */
	public Page addComponent(IComponent component){
		this.components.add(component);
		return this;
	}

	public String render(){
		return "";
	}

	public List<ISupport> getSupports(){
		return Collections.emptyList();
	}

	/**
	 * 
	 * @param key
	 * @param value
	 */
	public AbstractComponent addAttribute(String key, String value){
		this.addAttribute(key, value);
		return this;
	}

}